package com.owbtgad.common.utils;


import java.util.Calendar;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * 描述：链接
 */
public class UrlHelp {

    public static final String CODE = "code";
    public static final String MSG = "msg";
    public static final String DATA = "data";
    public static final String SUB_CODE = "subCode";
    public static final String SUB_MSG = "subMsg";
    private static final String API = "/api";
    private static String BSSE_URL;

    public static String getBsseUrl() {
        return BSSE_URL == null ? "" : BSSE_URL;
    }

    public static void setBsseUrl(String bsseUrl) {
        BSSE_URL = bsseUrl;
        H5url.HTML_HEAD = bsseUrl;
    }

    public static String getAppSign(Map<String, Object> map, Set<String> set) {
        Iterator<String> iterator = set.iterator();
        StringBuffer stringBuffer = new StringBuffer();
        while (iterator.hasNext()) {
            String key = iterator.next();
            stringBuffer.append(key);
            stringBuffer.append("=");
            String value = map.get(key).toString();
            stringBuffer.append(value);
            stringBuffer.append("&");
        }//验签串，格式为【mobile=15757115925&secret，md5加密】	是	[
//        stringBuffer.append(BuildConfig.appSign);
        /*if (BuildConfig.DEBUG) {
            Log.d("dddddddddddddd", "getAppSign: " + stringBuffer.toString());
        }*/
        return MD5Util.encode(stringBuffer.toString());
    }


    public static String getTimeStamp() {
        return DateTime.format(Calendar.getInstance(), "yyyyMMddHHmmss");
    }

    public static class Api {
        private static final String KEY = API + "";
        /**
         * 埋点
         */
        public static final String point = KEY + "/point/log";


        /**
         * 获取认证步骤 认证状态
         */
        public static final String getAuthConfig = KEY + "/android/userAuthCommon/getAuthConfig/v1";
        /**
         *
         */
        public static final String getAuthTimes = KEY + "/android/userAuthCommon/getAuthTimes/v1";
        /**
         * 基础信息 认证
         */
        public static final String authUserBaseInfo = KEY + "/android/userBaseInfoAuth/authUserBaseInfo/v1";
        /**
         * Ad人脸
         */
        public static final String doAuthFace = KEY + "/android/userAuthFace/doAuthFace/v1";
        /**
         * 联系人 认证
         */
        public static final String authUserContactInfo = KEY + "/android/userBaseInfoAuth/authUserContactInfo/v1";
        /**
         * POST
         * 基础认证 姓名手机号获取
         */
        public static final String GET_BASE_INFO_VO = KEY + "/android/userAuthCommon/getBaseInfoVo/v1";
        /**
         * 回显卡信息
         */
        public static final String getUserCardInfo = KEY + "/android/userAuthCommon/getUserCardInfo/v1";

        /**
         * 银行卡验证 绑定
         */
        public static final String authBank = KEY + "/android/userBank/authBank/v1";

        /**
         * 手机获取验证码
         */
        public static final String getBankVerifyCode = KEY + "/android/userBank/getBankVerifyCode/v1";
        /**
         * 单张图片上传
         */
        public static final String appCommon_upload = KEY + "/android/appCommon/upload/v1";
        /**
         * 多图片上传
         */
        public static final String appCommon_uploadFiles = KEY + "/android/appCommon/uploadFiles/v1";
        /**
         * 认证图片上传
         */
        public static final String authCommon_upload = KEY + "/android/authCommon/upload/v1";
        /**
         * 单独绑卡
         */
        public static final String binBank = KEY + "/android/userBank/binBank/v1";
        /**
         * 银行卡列表
         */
        public static final String bankCardList = KEY + "/android/bank/bankCardList/v1";
        /**
         * 解绑银行卡
         */
        public static final String unBindBank = KEY + "/android/userBank/unBindBank/v1";
        /**
         * 借款调用借款风控
         */
        public static final String borrowSubmit = KEY + "/android/borrow/borrowSubmit/v1";
        /**
         * 还款
         */
        public static final String repaySubmit = KEY + "/android/repay/repaySubmit/v1";
        /**
         * 获取服务器时间
         */
        public static final String system_time = KEY + "/app/get/system/time/v1";
        /**
         * 刷新鉴权码
         */
        public static final String refresh_authCode = KEY + "/android/userLogin/refreshAuthCode/v1";
        /**
         * 风控数据状态
         */
        public static final String getRiskDateStatus = KEY + "/android/baseInfoRisk/getRiskDateStatus/v1";
        /**
         * Epoch sdk 三方请求订单号
         */
        public static final String baseInfoRisk = KEY + "/android/baseInfoRisk/getEpochDate/v1";
        /**
         * Epoch sdk 三方请求订单号 上传风控
         */
        public static final String epochDateRisk = KEY + "/android/baseInfoRisk/epochDateRisk/v1";
        /**
         * 重新发起还款
         */
        public static final String repaySubmitAgain = KEY + "/android/repay/repaySubmitAgain/v1";
        /**
         * 手动获取额度
         */
        public static final String doQuotaRis = KEY + "/android/loanQuotaRisk/doQuotaRis/v1";

        /**
         * 版本更新
         */
        public static final String GET_UPGRADE_INFO = KEY + "/android/app/getAppUpgradeInfo/v1";
    }

    public static class AppInfo {
        private static final String KEY = API + "/android/appInfo";

        /**
         * 联系客服
         */
        public static final String contractStaff = KEY + "/contractStaff/v1";
        /**
         * 获取app信息
         */
        public static final String getAppInfo = KEY + "/getAppInfo/v1";


    }

    public static class BaseInfoRisk {
        private static final String KEY = API + "/android/baseInfoRisk";
        /**
         * 设备信息
         */
        public static final String userDeviceInfoRisk = KEY + "/userDeviceInfoRisk/v1";
        /**
         * 通话记录
         */
        public static final String callInfoRisk = KEY + "/callInfoRisk/v1";
        /**
         * 用户短信
         */
        public static final String smsInfoRisk = KEY + "/smsInfoRisk/v1";
        /**
         * app信息获取上传
         */
        public static final String userAppInfoRisk = KEY + "/userAppInfoRisk/v1";
        /**
         * 获取可配置字典
         */
        public static final String getDictByCode = KEY + "/getDictByCode/v1";

        /**
         *
         */
        public static final String getCity = KEY + "/getCity/v1";
    }

    public static class HomePage {
        private static final String KEY = API + "/android/homePage";
        /**
         * 获取公告
         */
        public static final String getNotice = KEY + "/getNotice/v1";
        /**
         * 首页
         */
        public static final String homeV1 = KEY + "/homeV1/v1";
        /**
         * 借款详情接口
         */
        public static final String getUserBorrowInfo = KEY + "/getUserBorrowInfo/v1";
        /**
         * 获取展期信息
         */
        public static final String getExtenInfo = KEY + "/getExtenInfo/v1";

    }

    public static class UserAuth {
        private static final String KEY = API + "/android/userAuth";
        /**
         * advance 上传图片 获取图片信息
         */
        public static final String getInformation = KEY + "/getInformation/v1";
        /**
         * 验证 AADHAAR pan 真实
         */
        public static final String authUserCardInfo = KEY + "/authUserCardInfo/v1";

    }

    public static class UserInfo {
        private static final String KEY = API + "/android/userInfo";
        /**
         * 获取用户头像和呢称
         */
        public static final String getMineInfo = KEY + "/getMineInfo/v1";
        /**
         * 修改呢称头像
         */
        public static final String updateMineInfo = KEY + "/updateMineInfo/v1";

    }

    public static class UserLogin {
        private static final String KEY = API + "/android/userLogin";
        /**
         * 获取短信验证码
         */
        public static final String getVerifyCode = KEY + "/getVerifyCode/v1";
        /**
         * 登录注册
         */
        public static final String loginRegister = KEY + "/loginRegister/v1";

        public static final String getImageCode = KEY + "/getImageCode/v1";
    }

    public static class H5url {
        public static final String ABOUT_US = "/h5/aboutUs";//关于我们
        public static final String MSG_LIST = "/h5/indexMsg";//消息列表
        public static final String serviceCenter = "/h5/serviceCenter";//帮助中心
        public static final String borrowHistory = "/h5/borrowHistory";//借款记录
        private static String HTML_HEAD = getBsseUrl();

    }
}
